	package com.rm2pt.generator.springboot.LabManage.entity;
	
	import org.hibernate.annotations.Fetch;
	import org.hibernate.annotations.FetchMode;
	import com.fasterxml.jackson.annotation.JsonBackReference;
	import com.fasterxml.jackson.annotation.JsonIgnore;
	import javax.persistence.FetchType;
	import java.util.ArrayList;
	import javax.persistence.OneToMany;
	import javax.persistence.OneToOne;
	import javax.persistence.CascadeType;
	import java.util.Date;
	import java.util.List;
	import java.io.Serializable;
	import javax.persistence.Entity;
	import javax.persistence.Transient;
	import javax.persistence.GeneratedValue;
	import javax.persistence.GenerationType;
	import javax.persistence.Id;
	import javax.persistence.JoinColumn;
	import javax.persistence.ManyToOne;
	import com.fasterxml.jackson.annotation.ObjectIdGenerators;
	import com.fasterxml.jackson.annotation.JsonIdentityInfo;
	
	@Entity
	public class StudentInGroup extends BaseEntity {
		
		/* all primary attributes */
		private String groupId;
		public String getGroupId() {
			return groupId;
		}
		public void setGroupId(String GroupId) {
			this.groupId = GroupId;
		}	
			
		private String studentId;
		public String getStudentId() {
			return studentId;
		}
		public void setStudentId(String StudentId) {
			this.studentId = StudentId;
		}	
			

		
		@JsonIgnore
		@Fetch(FetchMode.SUBSELECT)
		@OneToMany(cascade={CascadeType.MERGE,CascadeType.PERSIST},fetch=FetchType.EAGER)
				private List<Student> groupHasStudent = new ArrayList<Student>();
					
		public List<Student> getGroupHasStudent() {
			return groupHasStudent;
		}
				
		public void setGroupHasStudent(List<Student> GroupHasStudent) {
			this.groupHasStudent = GroupHasStudent;
		}
		
		@JsonIgnore
		@Fetch(FetchMode.SUBSELECT)
		@OneToMany(cascade={CascadeType.MERGE,CascadeType.PERSIST},fetch=FetchType.EAGER)
				private List<Group> studentInGroup = new ArrayList<Group>();
					
		public List<Group> getStudentInGroup() {
			return studentInGroup;
		}
				
		public void setStudentInGroup(List<Group> StudentInGroup) {
			this.studentInGroup = StudentInGroup;
		}
		
		@Override
		public boolean equals(Object obj) {
			if (this == obj)
				return true;
			if (obj == null)
				return false;
			if (getClass() != obj.getClass())
				return false;
			StudentInGroup other = (StudentInGroup) obj;
			if (!this.getRealid().equals(other.getRealid()))
				return false;
			else
				return true;
		}
	}
